package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.PayedOrderMapper;
import com.example.model.entity.PayedOrder;
import com.example.model.vo.UserVO;
import com.example.service.IPayedOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @program: backend
 * @author: zk
 * @create: 2023-04-23 16:06
 **/
@Service
@Slf4j
public class PayedOrderServiceImpl extends ServiceImpl<PayedOrderMapper, PayedOrder> implements IPayedOrderService {

    @Resource
    private HttpSession session;
    @Resource
    private PayedOrderMapper PayedOrderMapper;


    @Override
    public List<PayedOrder> getByUserId() {
        UserVO user = (UserVO) session.getAttribute("user");
        String userId = user.getId();
        List<PayedOrder> payedOrderList = query().eq("userId", userId).list();
        return payedOrderList;
    }
}
